package bg.ittalents.homework.airport;

public class Jet {

	private static final int MIN_RUNWAY_NUMBER = 0;
	private static final int MAX_RUNWAY_NUMBER = 100;

	private long remainingFuel;
	private int landedOnRunway;
	private boolean isLanded;
	int id;

	public Jet(int id,long remainingFuel) {
		super();
		if(id>0){
			this.id=id;
		}
		if (remainingFuel > 0) {
			this.remainingFuel = remainingFuel;
		}
	}

	public int getId() {
		return id;
	}

	public long getRemainingFuel() {
		return remainingFuel;
	}

	public void setRemainingFuel(long remainingFuel) {
		if (remainingFuel > 0) {
			this.remainingFuel = remainingFuel;
		}
	}

	public int getLandedOnRunway() {
		return landedOnRunway;
	}

	public void landOnRunway(int number) {
		if (validateRunwayNumber(number)) {
			isLanded = true;
			landedOnRunway = number;
		}
	}

	public void takeOff() {
		isLanded = false;
		landedOnRunway = 0;
	}

	public boolean isLanded() {
		return isLanded;
	}

	private boolean validateRunwayNumber(int number) {
		return number > MIN_RUNWAY_NUMBER && number < MAX_RUNWAY_NUMBER;
	}
}
